//
//  LlScrollView.m
//  UI06_homework
//
//  Created by 洛洛大人 on 16/6/13.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LlScrollView.h"

@implementation LlScrollView

-(instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    
    if(self) {
        [self setPropertys];
        
    }
    return self;
}


-(void)setPropertys {
    
    self.contentSize = CGSizeMake(2000, 0);
    
    self.showsHorizontalScrollIndicator = NO;
    self.showsVerticalScrollIndicator = NO;
    //分页效果
    self.pagingEnabled = YES;
    //回弹效果
    self.bounces = NO;
    //放大和缩小
    self.maximumZoomScale = 2;
    
    self.minimumZoomScale = 0.5;
    
    
    
}

//添加图片
-(void)addPictures:(NSArray<UIImage *> *)pictureArray {
    for(int i = 0; i < pictureArray.count; i++ ) {
        //滚动范围
        self.contentSize = CGSizeMake(CGRectGetWidth(self.bounds) * pictureArray.count, CGRectGetHeight(self.bounds));
       
      //创建UIImageView
        UIImageView * imageView = [[UIImageView alloc] initWithImage:pictureArray[i]];
        
        imageView.frame = CGRectMake(i * CGRectGetWidth(self.bounds), 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds));
        
        [self addSubview:imageView];
        [imageView release];
        
        
        
        
        
    }
    
    
}














@end
